<template>
    <div>
        <input type="text" v-model.lazy="msg"/>
        <input type="text" v-model.trim="msg"/>
        <input type="text" v-model.number="msg"/>
        <br/>
        <pre>{{msg | format}}</pre>
        <pre>{{typemsg}}</pre>
    </div>
</template>

<script>
    export default {
        name: "myform",
        data() {
            return {msg: '你好', typemsg: null}
        },
        watch: {
            'msg': function (newMsg, oldMsg) {
                this.typemsg = `旧值的类型是${typeof oldMsg} 新值的类型是${typeof newMsg}`;
            }
        },
        filters: {
            format: function (value) {
                if (value) {
                    return `${value} 加上了过滤器`;
                }
            }
        },
        methods: {}
    }
</script>

<style scoped>

</style>
